//
//  PlayerView.m
//  彩虹儿歌
//
//  Created by HelloWorld_L on 15/6/30.
//  Copyright (c) 2015年 HelloBaby. All rights reserved.
//

#import "PlayerView.h"

@implementation PlayerView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.rectBaseV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
//        self.rectBaseV.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];
        self.rectBaseV.layer.cornerRadius = frame.size.width / 2;
        self.rectBaseV.layer.masksToBounds = YES;
        self.rectBaseV.backgroundColor = [UIColor blackColor];
        
//        self.circleV = [[UIView alloc] initWithFrame:CGRectMake(0, -(frame.size.height / 2), frame.size.width, frame.size.width)];
//        self.circleV.layer.cornerRadius = frame.size.width / 2;
//        self.circleV.layer.masksToBounds = YES;
//        self.circleV.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];
        
        CGFloat imageF = frame.size.width / 8;
        self.musicImageV = [[UIImageView alloc] initWithFrame:CGRectMake( imageF, imageF, imageF * 6, imageF * 6)];
        self.musicImageV.layer.cornerRadius = imageF * 3;
        self.musicImageV.layer.masksToBounds = YES;
        self.musicImageV.userInteractionEnabled = YES;
        self.musicImageV.backgroundColor = [UIColor yellowColor];
        
        CGFloat btnF = self.musicImageV.frame.size.width;
        self.playerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.playerBtn.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
        self.playerBtn.frame = CGRectMake(0, 0, btnF, btnF);//加2避免位置有点斜。
        
        
        [self.musicImageV addSubview:self.playerBtn];
//        [self.circleV addSubview:self.musicImageV];
        [self.rectBaseV addSubview:self.musicImageV];
        [self addSubview:self.rectBaseV];
        
        [self.musicImageV release];
//        [self.circleV release];
        [self.rectBaseV release];
        
    }
    return self;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
